package com.sl.au.service.impl;

import java.util.Calendar;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.ExdeContractBillAgingLedger;
import com.sl.au.repository.ExdeContractBillAgingLedgerRepository;
import com.sl.au.service.ExdeContractBillAgingLedgerService;

@Service("ExdeContractBillAgingLedgerService")
@Transactional
public class ExdeContractBillAgingLedgerServiceImpl implements ExdeContractBillAgingLedgerService {

	@Autowired
	ExdeContractBillAgingLedgerRepository exdeContractBillAgingLedgerRepository;
	
	@Override
	public ExdeContractBillAgingLedger findStatisticsById(String cContractId) {
		Calendar c = Calendar.getInstance();
		String Month = "";
		if(c.get(Calendar.MONTH)<9){
			Month = "0"+(c.get(Calendar.MONTH)+1);
		}
		String YearAndMonth = c.get(Calendar.YEAR)+Month;
		System.out.println(YearAndMonth);
		return exdeContractBillAgingLedgerRepository.findStatisticsById(cContractId, YearAndMonth);
	}

}
